﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

using Engine;

namespace Game
{
    /// <summary>
    /// Nuestra interfaz para diferentes tipos de armas.
    /// </summary>
    public class Weapon
    {
        #region Members

        protected List<Bullet> mBulletList;
        protected int   mBulletsFired;
        protected int   mMaxBullets;
        protected int   mBulletsPerClip;
        protected int   mBulletsQuantity;
        protected int   mBulletsLeft;
        protected int   mDamage;
        protected float mFireRate;
        protected float mNextFireTime;
        protected float mReloadTime;
        protected bool  mAutoReload;
        protected bool  mIsActiveWeapon;
        protected string mWeaponName;
        protected string mLaserName;
        protected PlayerIndex mAuxIndex;
        #endregion

        #region Methods

        public virtual void Draw(Matrix playerWorld,Matrix view, Matrix projection) { }
        public virtual void Update(GameTime gameTime) { }
        public virtual void Shoot(Matrix playerWorld, Vector3 initialPos, Vector3 direction) { }
        public virtual void Reload(){ }
        #endregion

        #region SetsAndGets

        public void IncreaseBullets(int bullets)
        {
            if (this.mBulletsQuantity + bullets < this.MaxBullets)
                this.mBulletsQuantity += bullets;
            else
                this.mBulletsQuantity += this.MaxBullets - this.BulletsQuantity;
        }

        public List<Bullet> BulletsList
        {
            get { return mBulletList; }
        }
      
        public int MaxBullets
        {
            get { return mMaxBullets; }
            set { mMaxBullets = value; }
        }
        public int BulletsPerClip
        {
            get { return mBulletsPerClip; }
            set { mBulletsPerClip = value; }
        }
        public int BulletsQuantity
        {
            get { return mBulletsQuantity; }
        }
        public int BulletsLeft
        {
            get { return mBulletsLeft; }
            set { mBulletsLeft = value; }
        }
        public int Damage
        {
            get { return mDamage; }
            set { mDamage = value; }
        }
        public float FireRate
        {
            get { return mFireRate; }
            set { mFireRate = value; }
        }
        public float NextFireTime
        {
            get { return mNextFireTime; }
            set { mNextFireTime = value; }
        }
        public float ReloadTime
        {
            get { return mReloadTime; }
            set { mReloadTime = value; }
        }
        public bool AutoReload
        {
            get { return mAutoReload; }
            set { mAutoReload = value; }
        }
        public bool IsActiveWeapon
        {
            get { return mIsActiveWeapon; }
            set { mIsActiveWeapon = value; }
        }
  
        public string WeaponName
        {
            get { return mWeaponName; }
        }

        #endregion
    }
}
